package ddd7;

import java.util.Arrays;
import java.util.HashSet;


public class HashSetNumber {
    public static void main(String[] args) {
        Integer[] arr1 = {1, 2, 3};
        Integer[] arr2 = {3, 4, 5, 2};
        HashSet<Integer> set1 = new HashSet<Integer>();
        set1.addAll(Arrays.asList(arr1));
        HashSet<Integer> both = new HashSet<>(Arrays.asList(arr2));
        both.retainAll(set1);
        set1.addAll(Arrays.asList(arr2));
        set1.retainAll(both);
        System.out.println(set1);
    }
}
